export function formatLyrics(lyrics) {
  const lyricsList = []
  const lyricsLine = lyrics.split("\n")
  const timeReg = /\[(\d{2}):(\d{1,2}).(\d{2,3})\]/
  for(const lyric of lyricsLine) {
    if(!lyric) continue
    const result = timeReg.exec(lyric)
    // console.log(result);
    const min = result[1] * 60 * 1000
    const sec = result[2] * 1000
    const mil = result[3].length > 2 ? result[3] * 1 : result[3] * 10
    const time = min + sec + mil
    const text = lyric.replace(timeReg, "")
    lyricsList.push({time, text})
  }
  return lyricsList
}
